# 字段与格式校验
# utils/validators.py

import re

def is_valid_date_format(date_str):
    try:
        date_str = str(date_str)
        if not re.fullmatch(r"\d{8}", date_str):
            return False
        year = int(date_str[:4])
        month = int(date_str[4:6])
        day = int(date_str[6:8])
        return 1 <= month <= 12 and 1 <= day <= 31
    except:
        return False

def is_numeric(value):
    try:
        float(value)
        return True
    except (ValueError, TypeError):
        return False
